﻿using System;
using System.Collections.Generic;
using PPI.Client;
using PPI.Entities;

namespace PPIControls.ReportFilters
{
    public partial class reportFilterInspectionType : ReportFilterBaseControl
    {
        public reportFilterInspectionType()
        {
            InitializeComponent();

            cmbProjects.Items.Clear();
            cmbProjects.Items.AddRange(LCacheDataSingleton.Instance.Projects.ToArray());
            m_internalValues.Add("ProjectId", Int32.MinValue);
        }

        public Dictionary<string, object> FilterValues
        {
            get { return m_internalValues; }
        }

        public EVendor_Project SelectedProject
        {
            get
            {
                return cmbProjects.SelectedItem as EVendor_Project;
            }
        }

        private void cmbProjects_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (SelectedProject != null)
                m_internalValues["ProjectId"] = SelectedProject.Id;
            else
                m_internalValues["ProjectId"] = int.MinValue;
        }
    }
}
